<!DOCTYPE html>
<html lang="en">

<head>
    <meta charset="UTF-8">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>Document</title>
</head>

<body>
    <script>
        // 局部变量
        let num = 10
        console.log(num);
        function fn() {
            console.log(num);
        }
        fn()


        // 局部变量
        function add() {
            let unum = 2
        }
        console.log(unum);  // unum is not defined
    </script>
</body>

</html>